<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">

        <title></title>
    </head>
    <body>
        
        <script>
            let prom1 = new Promise((resolve,reject)=>{
                setTimeout(()=>{
                    resolve("aa")
                    // reject("aa")
                },1000)
            })
            let prom2 = new Promise((resolve,reject)=>{
                setTimeout(()=>{
                    resolve("bb")
                    reject("bb")
                },1000)
            })
            let prom3 = new Promise((resolve,reject)=>{
                setTimeout(()=>{
                    resolve("cc")
                    reject("dd")
                },1000)
            })
            let prom4 = Promise.all([prom1,prom2,prom3])
            //有一个reject，则阻塞其他
            .then((res)=>{
                console.log(res)
            })
            .catch((err)=>{
                console.log(err)
            })

            let prom5 = Promise.race([prom1,prom2,prom3])
            //执行第一个fulfilled
            .then((res)=>{
                console.log(res)
            })
            .catch((err)=>{
                console.log(err)
            })
        </script>
    </body>
</html>